<extend name="Public/base" />

<block name="body">
    <div ng-controller="CaigouerCtrl">
        <form method="POST" id="list">
        <!-- 标题栏 -->
        <div class="main-title">
            <h2>{$title}</h2>
            <a href="{:U('export')}&batch={$batch}" class="btn btn-default" >导出</a>
        </div>
        <div class="cf">
            <div class="search-form fl cf">
                <a class="btn btn-primary" href="{:U('Caigouer/assoproduct')}&batch={$batch}">处理该批次</a>
            </div>
        </div>
        </form>

        <!-- 数据列表 -->
        <div class="data-table table-striped">
            <table id="inventoryTable">
                    <thead>
                        <tr>
                            <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                            <th>商品名[规格]</th>
                            <th>状态</th>
                            <th>采购商家</th>
                            <th>总件</th>
                            <if condition="($user_name eq 'admin') OR ($group_name eq '财务')">
                                <th>单件价格</th>
                            </if>
                            <th>总重（斤）</th>
                            <if condition="($user_name eq 'admin') OR ($group_name eq '财务')">
                                <th>每斤价格</th>
                            </if>
                            <th>每箱箱费</th>
                            <th>每箱皮重</th>
                            <th>可存放时间</th>
                            <th>产地</th>
                            <th>备注</th>
                            <!--<th>操作</th>-->
                        </tr>
                    </thead>
                    <tbody>
                            <volist name="_list" id="vo">
                                <tr>
                                    <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>

                                    <td>
                                        {$vo.pname}[{$vo.spec}]
                                    </td>
                                    <td>
                                        <if condition="$vo['status'] eq 2">
                                            <span class="glyphicon glyphicon-remove-sign text-primary">待处理</span>
                                        </if>
                                        <if condition="$vo['status'] eq 3">
                                            <span class="text-success glyphicon glyphicon-ok">已处理</span>
                                        </if>
                                    </td>
                                    <td>{$vo.provider}</td>
                                    <td>{$vo.total_num}</td>
                                    <if condition="($user_name eq 'admin') OR ($group_name eq '财务')">
                                        <td>{$vo.unit_num_price}</td>
                                    </if>
                                    <td>{$vo.total_weight}</td>
                                    <if condition="($user_name eq 'admin') OR ($group_name eq '财务')">
                                        <td>{$vo.unit_weight_price}</td>
                                    </if>
                                    <td>{$vo.unit_box_fee}</td>
                                    <td>{$vo.unit_box_weight}</td>
                                    <td>{$vo.save_days}</td>
                                    <td>{$vo.chandi}</td>
                                    <td>{$vo.remark}</td>

                                    <!--<td>-->
                                        <!--<a ng-click="bind()" class="btn btn-primary">关联商品</a>-->
                                    <!--</td>-->
                                </tr>
                            </volist>
                    </tbody>
            </table>
        </div>
        <div class="page">
            {$_page}
        </div>
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script type="text/javascript" src="__JS__/caigouer.js"></script>
    <script type="text/javascript">
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('.input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
        //导航高亮
    highlight_subnav('{:U('Inventory/warn')}');
    </script>
</block>
